<?php
session_start();
ob_start();
include_once 'include/common.php';
global $core;
$core = new core();
if (!$core->CheckLogin()) {
    header('Location:login.php');
}

$zen_order_id = isset($_GET["id"]) ? intval($_GET["id"]) : 0;
if ($core->checkZenOrderByID($zen_order_id) == false) {
    header("location: zenOrderList.php");
}

$load_more = 0;
$total_result = array();
$list_customer_order = $core->getListCustomerOrder($zen_order_id, 1, $load_more, $total_result, 20);
$html_category = show_category(0);

function show_category($parent_id = 0) {
    global $core;
    $html = '';
    $category = $core->getCategoryByParentId($parent_id);

    if ($category) {
        foreach ($category as $cate) {
            $total_child_category = $core->getTotalChildCategoryById($cate->category_id);

            if ($total_child_category > 0) {
                $html.='<optgroup label="' . $cate->category_name . '">';
                $html.=show_category($cate->category_id);
                $html.='</optgroup>';
            } else {
                $html.=' <option value="' . $cate->category_id . '">' . $cate->category_name . '</option>';
            }
        }
    }
    return $html;
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <!--
                Charisma v1.0.0

                Copyright 2012 Muhammad Usman
                Licensed under the Apache License v2.0
                http://www.apache.org/licenses/LICENSE-2.0

                http://usman.it
                http://twitter.com/halalit_usman
        -->
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <meta http-equiv="content-language" content="vi"/>
        <title>Zen store</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
        <meta name="author" content="Muhammad Usman">

        <!-- The styles -->
        <link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
        <style type="text/css">
            body {
                padding-bottom: 40px;
            }
            .sidebar-nav {
                padding: 9px 0;
            }
        </style>
        <link href="css/bootstrap-responsive.css" rel="stylesheet">
        <link href="css/charisma-app.css" rel="stylesheet">
        <link href="css/style.css" rel="stylesheet">
        <link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet">

        <link href='css/chosen.css' rel='stylesheet'>
        <link href='css/uniform.default.css' rel='stylesheet'>

        <link href='css/jquery.cleditor.css' rel='stylesheet'>


        <link href='css/jquery.iphone.toggle.css' rel='stylesheet'>

        <link href='css/uploadify.css' rel='stylesheet'>

        <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

        <!-- The fav icon -->
        <link rel="shortcut icon" href="img/favicon.ico">

    </head>

    <body>
        <div id="page-wrap" class="page-wrap body-wrap ">
            <div id="page-tray" class="tray transition">
                <?php include_once ('new_menu.php'); ?>

                <div id="page-content" class="page-content transition profile-page">
                    <?php include_once ('navbar.php'); ?>
                    <div class="container-fluid">
                        <div class="row-fluid">
                            <div id="content" class="span12">        
                                <div id="toTop" class="icon_scrolltop" ><span>Trở lên trên</span></div>
<!--                                <div>
                                    <ul class="breadcrumb">
                                        <li>
                                            <a href="#">Home</a> <span class="divider">/</span>
                                        </li>
                                        <li>
                                            <a href="#">Tables</a>
                                        </li>
                                    </ul>
                                </div>-->
                                <div class="row-fluid">
                                    <div class="span12">
                                        <div  class="dataTables_length">
                                            <label>Sắp xếp theo:</label> <br/>
                                            <input style="width: 120px; margin: 10px 0px 0px 0px;" type="text" name="filter_search_text" id="filter_search_text" value="" >
                                            <select name="order_by" id="by_product_customer" style="width: 150px; margin: 10px 0px 0px 0px;" >
                                                <option value="0" selected="selected">Theo Khách or SP</option>                           
                                                <option value="1">Mã sản phẩm</option>
                                                <option value="2">Tên FB của khách</option>

                                            </select> 
                                            <select name="order_by" id="by_payment" style="width: 150px; margin: 10px 0px 0px 0px;" >
                                                <option value="0" selected="selected">Theo thanh toán</option>
                                                <option value="1" >Thanh toán</option>
                                                <option value="2" >Đã cọc</option>
                                                <option value="3">Chưa thanh toán</option>

                                            </select> 
                                            <select name="order_by" id="by_order_status" style="width: 150px; margin: 10px 0px 0px 0px;" >
                                                <option value="0" selected="selected">Theo trạng thái</option>

                                                <option value="1" >Store</option>
                                                <option value="2">Online</option>
                                                <option value="3">Hàng có sẵn</option>
                                                <option value="4">Đã nhận hàng</option>
                                                <option value="5">Đang shipping</option>
                                                <option value="6">Khách đã nhận</option>
                                                <option value="7">Hết hàng</option>
                                                <option value="8" >ORDER</option>
                                                <option value="9">Chưa chắc chắn</option>
                                            </select> 
                                            <select name="order_by" id="by_province" style="width: 150px; margin: 10px 0px 0px 0px;" >
                                                <option value="0" selected="selected">Theo tỉnh</option>
                                                <option value="1" >Tỉnh</option>
                                                <option value="2">Hà Nội</option>

                                            </select> 
                                            <input type="hidden" name="filter" id="status_filter" value="0">
                                            <a href="javascript:void(0)" class="btn btn-success" id="btn_filter" style=" margin: 10px 0px 0px 0px;">
                                                <i class="icon-zoom-in icon-white"></i>  
                                                Filter                                            
                                            </a>
                                            <a href="javascript:void(0)" class="btn btn-success" id="btn_export" style="display:none; margin: 10px 0px 0px 0px;">
                                                <i class="icon-zoom-in icon-white"></i>  
                                                Export to html                                           
                                            </a>
                                            <button  class="btn reset_search_filter" type="button" style=" margin: 10px 0px 0px 0px;">Cancel</button>
                                        </div>
                                    </div>

                                </div>

                                <div class="row-fluid sortable">		
                                    <div class="box span12">
                                        <div class="box-header well" data-original-title>
                                            <h2><i class="icon-user"></i> Danh sách đơn đặt hàng</h2>


                                            <a href="javascript:void(0)" class="btn btn-success" id="btn_fullscreen" style="float:right;background-color: #3599D4;margin-right: 10px;">
                                                <i class="icon-zoom-in icon-white"></i>  
                                                Toggle Fullscreen                                      
                                            </a>
                                        </div>
                                        <input type="hidden" name="loadmore_customer_order" id="loadmore_customer_order" value="<?php echo $load_more; ?>">
                                        <input type="hidden" name="page_customer_order" id="page_customer_order" value="1">
                                        <input type="hidden" name="zen_order_id" id="zen_order_id" value="<?php echo $zen_order_id; ?>">
                                        <input type="hidden" name="customer_order_id" id="customer_order_id" value="0">
                                        <div class="box-content" id="box_content_customer_order" style="height: 400px;">

                                            <div id="div_total">
                                                <table class="table table-striped table-bordered bootstrap-datatable datatable">
                                                    <tr>
                                                        <th>Tổng số khách hàng</th>
                                                        <th>Tổng số sản phẩm</th>
                                                        <?php
                                                        if ($_SESSION["user_role"] == 1) {
                                                            ?>
                                                            <th>Tổng AT<br/>(EU)</th>
                                                            <th>Tổng PT<br/>(EU)</th>
                                                            <?php
                                                        }
                                                        ?>

                                                        <th>Tổng tiền hàng<br/>(x1000 VNĐ)</th>

                                                        <th>Tổng cọc<br/>(x1000 VNĐ)</th>
                                                        <th>Tổng thừa<br/>(x1000 VNĐ)</th>
                                                        <th>Tổng thiếu<br/>(x1000 VNĐ)</th>

                                                    </tr>
                                                    <tr>
                                                        <td><?php echo $total_result["total_customer"]; ?></td>
                                                        <td><?php echo $total_result["total_product"]; ?></td>
                                                        <?php
                                                        if ($_SESSION["user_role"] == 1) {
                                                            ?>
                                                            <td><?php echo number_format($total_result["total_at"]); ?></td>
                                                            <td><?php echo number_format($total_result["total_pt"]); ?></td>
                                                            <?php
                                                        }
                                                        ?>

                                                        <td><?php echo number_format($total_result["total_order_money"] / 1000); ?></td>
                                                        <td><?php echo number_format($total_result["total_payment"] / 1000); ?></td>
                                                        <td><?php echo number_format($total_result["total_excess_cash"] / 1000); ?></td>
                                                        <td><?php echo number_format($total_result["total_debit"] / 1000); ?></td>

                                                    </tr>
                                                </table>
                                            </div>
                                            <div style="margin-bottom: 10px;">
                                                <!--                        <a class="btn btn-success btn_show_hide_group" href="javascript:void(0)" rel="1">
                                                                            <i class="icon-zoom-in icon-white"></i>  
                                                                            Ẩn/hiện nhóm 1                                           
                                                                        </a>-->
                                                <a class="btn btn-success btn_show_hide_group" href="javascript:void(0)" rel="2">
                                                    <i class="icon-zoom-in icon-white"></i>  
                                                    Ẩn nhóm 2                                            
                                                </a>
                                                <a class="btn btn-success btn_show_hide_group" href="javascript:void(0)" rel="3">
                                                    <i class="icon-zoom-in icon-white"></i>  
                                                    Ẩn nhóm 3                                            
                                                </a>
                                                <input type="hidden" name="hidden_group_1" value="0" id="hidden_group_1" >
                                                <input type="hidden" name="hidden_group_2" value="0" id="hidden_group_2" >
                                                <input type="hidden" name="hidden_group_3" value="0" id="hidden_group_3" >
                                            </div>
                                            <table class="table table-striped table-bordered bootstrap-datatable datatable" id="table_customer_order">
                                                <thead>

                                                    <tr>
                                                        <th>STT</th>
                                                        <th>Tên FB</th>
                                                        <th>Phone</th>
                                                        <th>Mã SP</th>

                                                        <th>Size</th>
                                                        <th>Số Lượng</th>
                                                        <th>Màu</th>
                                                        <th>Ảnh</th>
                                                        <th>Order status</th>
                                                        <th>Ghi chú sản phẩm</th>
                                                        <th>Giá<br/>(x1000 VNĐ)</th>
                                                        <?php
                                                        if ($_SESSION["user_role"] == 1) {
                                                            ?>
                                                            <th>Tổng AT<br/>(EU)</th>
                                                            <th>Tổng PT<br/>(EU)</th>
                                                            <?php
                                                        }
                                                        ?>

                                                        <th>Tổng Tiền<br/>(x1000 VNĐ)</th>
                                                        <th>Tổng Cọc<br/>(x1000 VNĐ)</th>
                                                        <th>Thiếu<br/>(x1000 VNĐ)</th>
                                                        <th>Thừa<br/>(x1000 VNĐ)</th>
                                                        <th>Ghi chú đơn hàng</th>
                                                        <th>Địa chỉ</th>
                                                        <th>Tỉnh</th>
                                                        <th>Tên thật</th>
                                                        <th>Tài khoản bank</th>
                                                        <th>Actions</th>
                                                    </tr>
                                                </thead>   
                                                <tbody id="tbody_order_list">
                                                    <?php
                                                    if ($list_customer_order) {
                                                        $customer_order_id = 0;
                                                        $count = 0;
                                                        foreach ($list_customer_order as $customer_order) {

                                                            if ($customer_order_id != $customer_order->customer_order_id) {
                                                                $count++;
                                                                $customer_order_id = $customer_order->customer_order_id;
                                                                ?>
                                                                <tr class="tr_<?php echo $customer_order->customer_order_id; ?>">
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo $count; ?></td>
                                                                    <?php
                                                                    if ($customer_order->facebook_link != "") {
                                                                        ?>
                                                                        <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><a href="<?php echo $customer_order->facebook_link; ?>" target="_blank"><?php echo $customer_order->facebook_name; ?></a></td>
                                                                        <?php
                                                                    } else {
                                                                        ?>
                                                                        <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo $customer_order->facebook_name; ?></td>
                                                                        <?php
                                                                    }
                                                                    ?>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><a href="addCustomer.php?id=<?php echo $customer_order->customer_id; ?>" target="_blank"><?php echo $customer_order->phone; ?></a></td>
                                                                    <?php
                                                                    if ($customer_order->link_web == "") {
                                                                        ?>
                                                                        <td class="center"><?php echo $customer_order->product_code; ?></td>
                                                                        <?php
                                                                    } else {
                                                                        ?>
                                                                        <td class="center"><a href="<?php echo $customer_order->link_web; ?>" target="_blank"><?php echo $customer_order->product_code; ?></a></td>
                                                                        <?php
                                                                    }
                                                                    ?>


                                                                    <td class="center"><?php echo $customer_order->product_size; ?></td>
                                                                    <td class="center"><?php echo $customer_order->product_num; ?></td>
                                                                    <td class="center"><?php echo $customer_order->product_color; ?></td>
                                                                    <td class="center"><img rel="photo/<?php echo $customer_order->main_photo; ?>" class="photo_product" src="photo/thumb_photo/200_<?php echo $customer_order->main_photo; ?>" width="100px"></td>
                                                                    <td class="center">
                                                                        <select class='select_order_status' style="width: 120px;" rel="<?php echo $customer_order->id; ?>" >
                                                                            <option value=0 <?php if ($customer_order->order_status == 0) echo 'selected'; ?>>Store</option>
                                                                            <option value=1 <?php if ($customer_order->order_status == 1) echo 'selected'; ?>>Online</option>
                                                                            <option value=2 <?php if ($customer_order->order_status == 2) echo 'selected'; ?>>Hàng có sẵn</option>
                                                                            <option value=3 <?php if ($customer_order->order_status == 3) echo 'selected'; ?>>Đã nhận hàng</option>
                                                                            <option value=4 <?php if ($customer_order->order_status == 4) echo 'selected'; ?>>Đang shipping</option>
                                                                            <option value=5 <?php if ($customer_order->order_status == 5) echo 'selected'; ?>>Khách đã nhận</option>
                                                                            <option value=6 <?php if ($customer_order->order_status == 6) echo 'selected'; ?>>Hết hàng</option>
                                                                            <option value=7 <?php if ($customer_order->order_status == 7) echo 'selected'; ?>>ORDER</option>
                                                                            <option value=8 <?php if ($customer_order->order_status == 8) echo 'selected'; ?>>Chưa chắc chắn</option>
                                                                        </select>
                                                                        <div class="history_status"></div>
                                                                    </td>
                                                                    <td class="center"><?php echo $customer_order->description; ?></td>
                                                                    <td class="center"><?php echo number_format($customer_order->product_price / 1000); ?></td>
                                                                    <?php
                                                                    if ($_SESSION["user_role"] == 1) {
                                                                        ?>
                                                                        <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo number_format($customer_order->total_at); ?></td>
                                                                        <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo number_format($customer_order->total_pt); ?></td>
                                                                        <?php
                                                                    }
                                                                    ?>

                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo number_format($customer_order->total_order_money / 1000); ?></td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>">
                                                                        
                                                                        <a  class="popup_zen_payment" href="javascript:void(0);" rel="<?php echo $customer_order->customer_order_id; ?>"><?php echo number_format($customer_order->total_payment / 1000); ?></a>
                                                                    </td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php
                                                                        if ($customer_order->total_current_money < 0)
                                                                            echo number_format($customer_order->total_current_money / 1000);
                                                                        else
                                                                            echo "0";
                                                                        ?></td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>">
                                                                        <?php
                                                                        if ($customer_order->total_current_money > 0)
                                                                            echo number_format($customer_order->total_current_money / 1000);
                                                                        else
                                                                            echo "0";
                                                                        ?>
                                                                    </td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo $customer_order->order_description; ?></td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo $customer_order->address; ?></td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>">
                                                                        <?php
                                                                        if ($customer_order->province == 1)
                                                                            echo "Ở tỉnh";
                                                                        else
                                                                            echo "Ở HN";
                                                                        ?>
                                                                    </td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo $customer_order->name; ?></td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>"><?php echo $customer_order->bank_account; ?></td>
                                                                    <td class="center" rowspan="<?php echo $customer_order->total_product; ?>">
                                                                        <a class="btn btn-info btn_edit_customer_order" href="javascript:void(0)" rel="<?php echo $customer_order->customer_order_id; ?>">
                                                                            <i class="icon-edit icon-white"></i>  
                                                                            Edit                                            
                                                                        </a>
                                                                        <a style=" margin: 10px 0px;" rel="<?php echo $customer_order->customer_order_id; ?>" class="btn btn-danger btn_delete_order_detail" href="javascript:void(0)">
                                                                            <i class="icon-trash icon-white"></i> 
                                                                            Delete
                                                                        </a>
                                                                    </td>
                                                                </tr>
                                                                <?php
                                                            } else {
                                                                ?>
                                                                <tr class="tr_<?php echo $customer_order->customer_order_id; ?>">
                                                                    <?php
                                                                    if ($customer_order->link_web == "") {
                                                                        ?>
                                                                        <td class="center"><?php echo $customer_order->product_code; ?></td>
                                                                        <?php
                                                                    } else {
                                                                        ?>
                                                                        <td class="center"><a href="<?php echo $customer_order->link_web; ?>" target="_blank"><?php echo $customer_order->product_code; ?></a></td>
                                                                        <?php
                                                                    }
                                                                    ?>

                                                                    <td class="center"><?php echo $customer_order->product_size; ?></td>
                                                                    <td class="center"><?php echo $customer_order->product_num; ?></td>
                                                                    <td class="center"><?php echo $customer_order->product_color; ?></td>
                                                                    <td class="center"><img rel="photo/<?php echo $customer_order->main_photo; ?>" class="photo_product" src="photo/thumb_photo/200_<?php echo $customer_order->main_photo; ?>" width="100px"></td>
                                                                    <td class="center">
                                                                        <select class='select_order_status' style="width: 120px;" rel="<?php echo $customer_order->id; ?>">
                                                                            <option value=0 <?php if ($customer_order->order_status == 0) echo 'selected'; ?>>Store</option>
                                                                            <option value=1 <?php if ($customer_order->order_status == 1) echo 'selected'; ?>>Online</option>
                                                                            <option value=2 <?php if ($customer_order->order_status == 2) echo 'selected'; ?>>Hàng có sẵn</option>
                                                                            <option value=3 <?php if ($customer_order->order_status == 3) echo 'selected'; ?>>Đã nhận hàng</option>
                                                                            <option value=4 <?php if ($customer_order->order_status == 4) echo 'selected'; ?>>Đang shipping</option>
                                                                            <option value=5 <?php if ($customer_order->order_status == 5) echo 'selected'; ?>>Khách đã nhận</option>
                                                                            <option value=6 <?php if ($customer_order->order_status == 6) echo 'selected'; ?>>Hết hàng</option>
                                                                            <option value=7 <?php if ($customer_order->order_status == 7) echo 'selected'; ?>>ORDER</option>
                                                                            <option value=8 <?php if ($customer_order->order_status == 8) echo 'selected'; ?>>Chưa chắc chắn</option>
                                                                        </select>
                                                                        <div class="history_status"> </div>
                                                                    </td>
                                                                    <td class="center"><?php echo $customer_order->description; ?></td>
                                                                    <td class="center"><?php echo number_format($customer_order->product_price / 1000); ?></td>

                                                                </tr>
                                                                <?php
                                                            }
                                                        }
                                                    }
                                                    ?>
                                                </tbody>
                                            </table>
                                            <input type="hidden" name="last_customer_order_id" id="last_customer_order_id" value="<?php echo $customer_order_id ?>">
                                            <input type="hidden" name="var_count" id="var_count" value="<?php echo $count ?>">
                                            <div id="loading" style="display:none;width: 220px; height: 19px;margin: 0 auto;"><img title="img/ajax-loaders/ajax-loader-7.gif" src="img/ajax-loaders/ajax-loader-7.gif"></div>
                                        </div>
                                    </div><!--/span-->

                                </div><!--/row-->
                                <div class="row-fluid sortable " id='form_add_customer_order'>
                                    <div class="box span12">
                                        <div class="box-header well" id="title_edit_customer_order" data-original-title>
                                            <h2><i class="icon-edit"></i> Thêm chi tiết đơn hàng</h2>

                                        </div>
                                        <div class="box-content">
                                            <div class="form-horizontal">
                                                <fieldset>

                                                    <div class="control-group">
                                                        <h4>Thông tin khách hàng </h4>

                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" ></label>
                                                        <div class="controls">
                                                            <div class="alert alert-error" id="alert-error-customer" style="display:none">
                                                            </div>

                                                        </div>
                                                    </div>
                                                    <input type="hidden" name="customer_id" id="customer_id" value="">
                                                    <input type="hidden" name="product_id" id="product_id" value="0">

                                                    <div class="control-group">
                                                        <label class="control-label" for="product_name">Số điện thoại* </label>
                                                        <div class="controls">
                                                            <div class="input-append">
                                                                <input type="text" size="16" name="customer_phone" id="customer_phone">
                                                                <button type="button" class="btn" id="get_customer_info">Check phone</button>
                                                            </div>

                                                        </div>
                                                    </div>

                                                    <div class="control-group">
                                                        <label class="control-label" for="product_name">Facebook name* </label>
                                                        <div class="controls">
                                                            <div class="input-append">
                                                                <input type="text"  name="customer_fb_name" id="customer_fb_name"  >
                                                                <button type="button" class="btn" id="get_customer_by_name">Check fb name</button>
                                                            </div>
                                                            <ul class="select_fb_name" id="list_customer_fb_name">


                                                            </ul>
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="product_name">Địa chỉ </label>
                                                        <div class="controls">
                                                            <input type="text" class="span6 typeahead" id="customer_address"  >

                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="product_name">Tỉnh </label>
                                                        <div class="controls">
                                                            <label class="checkbox inline">
                                                                <div class="checker" id="uniform-inlineCheckbox1"><span class=""><input type="checkbox" value="1" id="customer_province" style="opacity: 0;"></span></div>
                                                            </label>

                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="product_name">Ghi chú đơn hàng của khách này:</label>
                                                        <div class="controls">
                                                            <textarea name="order_description" id="order_description"></textarea>

                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <h4>Chọn sản phẩm </h4>

                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" ></label>
                                                        <div class="controls">
                                                            <div class="alert alert-error alert-error-product"  style="display:none">
                                                            </div>

                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="product_name">Mã sản phẩm* </label>
                                                        <div class="controls">
                                                            <div class="input-append">
                                                                <input type="text"  id="product_code">
                                                                <button type="button" class="btn" id="get_product_info_by_code">Check</button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="control-group order_detail_new_product hidden">
                                                        <label class="control-label" for="product_name">Tên sản phẩm* </label>
                                                        <div class="controls">
                                                            <input type="text"  id="product_name">
                                                        </div>
                                                    </div>
                                                    <div class="control-group order_detail_new_product hidden">
                                                        <label class="control-label" for="link_web">Link web</label>
                                                        <div class="controls">
                                                            <input type="text" class="span6 typeahead" id="link_web" value=""  >

                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="main_photo">Ảnh sản phẩm* </label>
                                                        <input type="hidden" name="file_name_temp" id="file_main_photo_temp" value="">
                                                        <input type="hidden" name="folder_temp" id="folder_temp" value="">
                                                        <div class="controls">
                                                            <div class="input-append order_detail_new_product hidden">
                                                                <input type="text"  id="main_photo">
                                                                <button type="button" class="btn" id="btn_upload_photo">upload photo</button>
                                                            </div>
                                                            <div style="margin: 10px;width: 200px; height: 200px;  border: 1px solid #DDDDDD;" id="choose_imge"></div>

                                                        </div>
                                                    </div>
                                                    <div class="control-group order_detail_new_product hidden">
                                                        <label class="control-label" for="product_category">Category*</label>
                                                        <div class="controls">
                                                            <select  id="product_category" >
                                                                <option value=""></option>
                                                                <?php echo $html_category; ?>

                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="manufacture">Brand </label>
                                                        <div class="controls">                                    
                                                            <select id="manufacture" >
                                                                <option value="Zara">Zara</option>
                                                                <option value="Mango">Mango</option>
                                                                <option value="Hm">Hm</option>
                                                                <option value="Parfumes">Parfumes</option>
                                                                <option value="Cosmetics">Cosmetics</option>


                                                            </select>

                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="product_size">Size </label>
                                                        <div class="controls">

                                                            <select id="product_size" >


                                                            </select>
                                                            <input type="text"  id="new_size">
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="product_number" >Số lượng* </label>
                                                        <div class="controls">
                                                            <input type="text"  class="span6 typeahead" style="width:200px" id="product_number"  >


                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="product_color">Màu </label>
                                                        <div class="controls">

                                                            <select id="product_color" >

                                                            </select>
                                                            <input type="text"  id="new_color">

                                                        </div>
                                                    </div>

                                                    <div class="control-group">
                                                        <label class="control-label" for="product_price" >Đơn giá*</label>
                                                        <div class="controls">
                                                            <div class="input-prepend input-append">
                                                                <input id="product_price" type="text" size="16">
                                                                <span class="add-on">000 VNĐ</span>
                                                            </div>


                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="product_description">Ghi chú sản phẩm</label>
                                                        <div class="controls">
                                                            <textarea name="product_description" id="product_description"></textarea>

                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" ></label>
                                                        <div class="controls">
                                                            <div class="alert alert-error alert-error-product"  style="display:none">
                                                            </div>

                                                        </div>
                                                    </div>
                                                    <div class="control-group">

                                                        <div class="controls">
                                                            <input type="hidden" name="is_new_product" id="is_new_product" value="0">
                                                            <button  class="btn btn-primary noty"  id="add_more_product">Thêm sản phẩm</button>
                                                            <button id="reset_form_product" class="btn" type="reset">Cancel product</button>
                                                            *Thêm sản phẩm cho khách này trước khi save

                                                        </div>
                                                    </div>

                                                    <table class="table table-striped table-bordered bootstrap-datatable datatable">
                                                        <thead>
                                                            <tr>

                                                                <th>Mã SP</th>
                                                                <th>Size</th>
                                                                <th>Số Lượng</th>
                                                                <th>Màu</th>
                                                                <th>Ảnh</th>
                                                                <th>Giá<br/>(x1000 VNĐ)</th>
                                                                <th>Ghi chú</th>
                                                                <th>Actions</th>
                                                            </tr>
                                                        </thead>   
                                                        <tbody id="tbody_order_product_list">

                                                        </tbody>
                                                    </table>
                                                    <div class="alert alert-error" id="alert-error-order" style="display:none">
                                                    </div>
                                                    <div class="form-actions">
                                                        <button type="submit" class="btn btn-primary" id="save_order_detail">Save changes</button>
                                                        <button type="reset" class="btn" id="reset_form">Cancel</button>
                                                    </div>
                                                </fieldset>
                                            </div>   

                                        </div>
                                    </div><!--/span-->

                                </div><!--/row-->
                            </div><!--/#content.span10-->



                        </div><!--/fluid-row-->
                        <?php include_once ('footer.php'); ?>
                    </div><!--/.fluid-container-->
                </div>
            </div>
        </div>


        <!--vung  html ẩn-->    
        <!-- hien thi list ảnh sp-->
        <div class="modal hide fade" id="photoList">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">×</button>
                <h3>Choose Image</h3>
            </div>
            <div class="modal-body">
                <input type="hidden" name="load_more_image" id="loadmore_image" value="1">
                <input type="hidden" name="page_image" id="page_image" value="1">
                <ul class="thumbnails gallery" id="list_photo_image" style="margin-left:0px;">
                </ul>
                <div id="loading" style="display:none;width: 220px; height: 19px;margin: 0 auto;"><img title="img/ajax-loaders/ajax-loader-7.gif" src="img/ajax-loaders/ajax-loader-7.gif"></div>
            </div>
            <div class="modal-footer">
                <a href="#" class="btn" data-dismiss="modal">Close</a>

            </div>
        </div>
        <!-- hien thi ảnh sp phóng to-->
        <div class="modal hide fade" id="modal_photo_zoom">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">×</button>
                <h3>Choose Image</h3>
            </div>
            <div class="modal-body" id="photo_zoom">

            </div>
            <div class="modal-footer">
                <a href="#" class="btn" data-dismiss="modal">Close</a>

            </div>
        </div>
        <div style="display: none;" id="dialog-confirm" title="Cảnh báo trùng số phone">
            <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>Số phone đã tồn tai nhưng có tên FB khác.Ấn tiếp tục để update tên FB mới và thêm đơn hàng cho khách đã tồn tại.Ấn Cancel để hủy.</p>
        </div>
        <!-- hien thi đặt cọc-->
        <div class="modal hide fade" id="modal_zen_payment" style="width:700px; left:40%">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">×</button>
                <h3>Choose Image</h3>
            </div>
            <div class="modal-body" id="content_zen_payment">
                <div class="row-fluid sortable">
                    <div class="box span12">
                        <div class="box-header well" data-original-title>
                            <h2><i class="icon-edit"></i> Thanh toán</h2>

                        </div>
                        <div class="box-content">
                            <form class="form-horizontal">
                                <fieldset>
                                    <div class="control-group">
                                        <label class="control-label" ></label>
                                        <div class="controls">
                                            <div class="alert alert-error" id="alert-error-payment" style="display:none">
                                            </div>
                                            <div class="alert alert-success" id="alert-success-payment" style="display:none"></div>
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label class="control-label" for="">Tên khách hàng </label>
                                        <div class="controls">
                                            <input type="text" class="span6 typeahead" readonly value="" id="payment_customer_name"  >



                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="type_payment">Cách thanh toán </label>
                                        <div class="controls">
                                            <select id="type_payment">
                                                <option value="2">Cọc VCB</option>
                                                <option value="1">Cọc trực tiếp</option>
                                                <option value="3">Refund VCB</option>
                                                <option value="4">Refund trực tiếp</option>
                                            </select>

                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="payment">Số tiền đặt cọc </label>
                                        <div class="controls">
                                            <input type="text" class="span6 typeahead" id="payment" style='display:inline-block' ><div style=' margin-left: 5px;display:inline-block'>.000 VNĐ</div>

                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="payment_date">Ngày đặt cọc </label>
                                        <div class="controls">
                                            <input type="text" class="input-xlarge datepicker" id="payment_date" value="02/16/12">

                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="payment_description">Ghi chú </label>
                                        <div class="controls">
                                            <textarea name="product_description" id="payment_description"></textarea>

                                        </div>
                                    </div>
                                    <div class="form-actions">
                                        <button type="button" class="btn btn-primary" id="save_payment">Save changes</button>
                                        <button type="reset" class="btn" id="reset">Cancel</button>
                                    </div>
                                </fieldset>
                            </form>   

                        </div>
                    </div><!--/span-->

                </div><!--/row-->
                <div class="row-fluid sortable">		
                    <div class="box span12">
                        <div class="box-header well" data-original-title>
                            <h2><i class="icon-user"></i>Lịch sử thanh toán</h2>

                        </div>
                        <input type="hidden" name="payment_id" id="payment_id" value="0">
                        <input type="hidden" name="payment_customer_order_id" id="payment_customer_order_id" value="">
                        <div class="box-content" id="box_content_customer_order_payment" >
                            <!--content payment-->
                        </div>
                    </div><!--/span-->

                </div><!--/row-->
            </div>
            <div class="modal-footer">
                <a href="#" class="btn" data-dismiss="modal">Close</a>

            </div>
        </div>
        <!--hết vùng html ẩn-->



        <!-- external javascript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->

        <!-- jQuery -->
        <script src="js/jquery-1.7.2.min.js"></script>
        <!-- jQuery UI -->
        <script src="js/jquery-ui-1.8.21.custom.min.js"></script>
        <!-- transition / effect library -->
        <script src="js/bootstrap-transition.js"></script>
        <!-- alert enhancer library -->
        <script src="js/bootstrap-alert.js"></script>
        <!-- modal / dialog library -->
        <script src="js/bootstrap-modal.js"></script>
        <!-- custom dropdown library -->
        <script src="js/bootstrap-dropdown.js"></script>
        <!-- scrolspy library -->
        <script src="js/bootstrap-scrollspy.js"></script>
        <!-- library for creating tabs -->
        <script src="js/bootstrap-tab.js"></script>
        <!-- library for advanced tooltip -->
        <script src="js/bootstrap-tooltip.js"></script>
        <!-- popover effect library -->
        <script src="js/bootstrap-popover.js"></script>
        <!-- button enhancer library -->
        <script src="js/bootstrap-button.js"></script>
        <!-- accordion library (optional, not used in demo)menu scroll -->
        <script src="js/bootstrap-collapse.js"></script>

        <!-- autocomplete library -->
        <script src="js/bootstrap-typeahead.js"></script>

        <!-- library for cookie management -->
        <script src="js/jquery.cookie.js"></script>
        <script src='js/jquery.dataTables.min.js'></script>


        <!-- select or dropdown enhancer -->
        <script src="js/jquery.chosen.min.js"></script>
        <!-- checkbox, radio, and file input styler -->
        <script src="js/jquery.uniform.min.js"></script>
        <!-- notification plugin -->
        <script src="js/jquery.noty.js"></script>
        <!-- rich text editor library -->
        <script src="js/jquery.cleditor.min.js"></script>
        <!-- for iOS style toggle switch -->
        <script src="js/jquery.iphone.toggle.js"></script>
        <!-- autogrowing textarea plugin -->
        <script src="js/jquery.autogrow-textarea.js"></script>

        <!-- history.js for cross-browser state change on ajax -->
        <script src="js/jquery.history.js"></script>
        <!-- application script for Charisma demo -->
        <script src="js/common.js?t=7"></script>
        <script src="js/orderDetail.js?t=178"></script>
        <script src="js/addPayment.js?t=18"></script>


    </body>
</html>


